program asd;
var	a:array[1..50] of integer;
	i,j,max,n:integer;
begin
n:=50;
for i:=1 to n do a[i]:=random(2001)-1000;

max:=-1001;
for i:=1 to n do if (abs(a[i] mod 10) = 5) and (a[i]>max) then max:=a[i];
writeln(max);

for i:=1 to n do writeln(a[i]:6,' [',i,']');

end.
